package com.netease.liang.ch03.conditional;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class MagicExistsCondition implements Condition {
    @Override
    public boolean matches(ConditionContext ctxt, AnnotatedTypeMetadata metadata) {
        //System.setProperty("magic", "hello");
        Environment env = ctxt.getEnvironment();
        System.out.println(env.containsProperty("magic"));
        return env.containsProperty("magic");
    }
}
